

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>pysiriproxy.utf &mdash; pysiriproxy v0.0.7 documentation</title>
    <link rel="stylesheet" href="../../_static/default.css" type="text/css" />
    <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../../',
        VERSION:     '0.0.7',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../../_static/jquery.js"></script>
    <script type="text/javascript" src="../../_static/underscore.js"></script>
    <script type="text/javascript" src="../../_static/doctools.js"></script>
    <link rel="top" title="pysiriproxy v0.0.7 documentation" href="../../index.html" />
    <link rel="up" title="Module code" href="../index.html" /> 
  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li><a href="../../index.html">pysiriproxy v0.0.7 documentation</a> &raquo;</li>
          <li><a href="../index.html" accesskey="U">Module code</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <h1>Source code for pysiriproxy.utf</h1><div class="highlight"><pre>
<span class="c"># Copyright (C) (c) 2012 Brett Ponsler, Pete Lamonica, Pete Lamonica</span>
<span class="c"># This file is part of pysiriproxy.</span>
<span class="c">#</span>
<span class="c"># pysiriproxy is free software: you can redistribute it and/or modify</span>
<span class="c"># it under the terms of the GNU General Public License as published by</span>
<span class="c"># the Free Software Foundation, either version 3 of the License, or</span>
<span class="c"># (at your option) any later version.</span>
<span class="c">#</span>
<span class="c"># pysiriproxy is distributed in the hope that it will be useful,</span>
<span class="c"># but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<span class="c"># MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span>
<span class="c"># GNU General Public License for more details.</span>
<span class="c">#</span>
<span class="c"># You should have received a copy of the GNU General Public License</span>
<span class="c"># along with pysiriproxy.  If not, see &lt;http://www.gnu.org/licenses/&gt;.</span>
<span class="sd">&#39;&#39;&#39;The utf module contains a class dedicated to converting UTF strings</span>
<span class="sd">into ASCII strings.</span>

<span class="sd">&#39;&#39;&#39;</span>


<div class="viewcode-block" id="Utf"><a class="viewcode-back" href="../../_generated/pysiriproxy_utf.html#pysiriproxy.utf.Utf">[docs]</a><span class="k">class</span> <span class="nc">Utf</span><span class="p">:</span>
    <span class="sd">&#39;&#39;&#39;The Utf class provides a dictionary of UTF strings that should be</span>
<span class="sd">    replaced with ASCII equivalent strings.</span>

<span class="sd">    &#39;&#39;&#39;</span>

    <span class="n">Replacements</span> <span class="o">=</span> <span class="p">{</span>
        <span class="s">&quot;</span><span class="se">\xe2\x80\x98</span><span class="s">&quot;</span><span class="p">:</span> <span class="s">&quot;&#39;&quot;</span><span class="p">,</span>
        <span class="s">&quot;</span><span class="se">\xe2\x80\x99</span><span class="s">&quot;</span><span class="p">:</span> <span class="s">&quot;&#39;&quot;</span><span class="p">,</span>
        <span class="s">&quot;</span><span class="se">\xe2\x80\x9c</span><span class="s">&quot;</span><span class="p">:</span> <span class="s">&#39;&quot;&#39;</span><span class="p">,</span>
        <span class="s">&quot;</span><span class="se">\xe2\x80\x9d</span><span class="s">&quot;</span><span class="p">:</span> <span class="s">&#39;&quot;&#39;</span><span class="p">,</span>
        <span class="s">&quot;</span><span class="se">\xe2\x80\x93</span><span class="s">&quot;</span><span class="p">:</span> <span class="s">&#39;-&#39;</span><span class="p">,</span>
        <span class="s">&quot;</span><span class="se">\xe2\x80\x94</span><span class="s">&quot;</span><span class="p">:</span> <span class="s">&#39;--&#39;</span><span class="p">,</span>
        <span class="s">&quot;</span><span class="se">\xe2\x80\xa6</span><span class="s">&quot;</span><span class="p">:</span> <span class="s">&#39;...&#39;</span><span class="p">,</span>
        <span class="p">}</span>
    <span class="sd">&#39;&#39;&#39;The Replacements property contains a dictionary mapping UTF strings</span>
<span class="sd">    to the ASCII equivalent strings which they will be replaced with.</span>

<span class="sd">    &#39;&#39;&#39;</span>

    <span class="nd">@classmethod</span>
<div class="viewcode-block" id="Utf.replaceUtf"><a class="viewcode-back" href="../../_generated/pysiriproxy_utf.html#pysiriproxy.utf.Utf.replaceUtf">[docs]</a>    <span class="k">def</span> <span class="nf">replaceUtf</span><span class="p">(</span><span class="n">cls</span><span class="p">,</span> <span class="n">utfString</span><span class="p">):</span>
        <span class="sd">&#39;&#39;&#39;Replace all of the UTF strings in the :attr:`Replacements`</span>
<span class="sd">        property with their ASCII equivalent strings.</span>

<span class="sd">        * utfString -- The string containing UTF characters</span>

<span class="sd">        &#39;&#39;&#39;</span>
        <span class="k">for</span> <span class="n">replacement</span><span class="p">,</span> <span class="n">value</span> <span class="ow">in</span> <span class="n">Utf</span><span class="o">.</span><span class="n">Replacements</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span>
            <span class="n">utfString</span> <span class="o">=</span> <span class="n">utfString</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">replacement</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>

        <span class="k">return</span> <span class="n">utfString</span></div></div>
</pre></div>

          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="../../search.html" method="get">
      <input type="text" name="q" size="18" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li><a href="../../index.html">pysiriproxy v0.0.7 documentation</a> &raquo;</li>
          <li><a href="../index.html" >Module code</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
        &copy; Copyright 2012, Brett Ponsler.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.1.
    </div>
  </body>
</html>